Optimal. Leaf size=159 \[ -\frac {4 a^2 \cos ^4\left (\frac {e}{2}+\frac {f x}{2}\right )}{d (c+d x)}-\frac {a^2 f \text {CosIntegral}\left (\frac {2 c f}{d}+2 f x\right ) \sin \left (2 e-\frac {2 c f}{d}\right )}{d^2}-\frac {2 a^2 f \text {CosIntegral}\left (\frac {c f}{d}+f x\right ) \sin \left (e-\frac {c f}{d}\right )}{d^2}-\frac {2 a^2 f \cos \left (e-\frac {c f}{d}\right ) \text {Si}\left (\frac {c f}{d}+f x\right )}{d^2}-\frac {a^2 f \cos \left (2 e-\frac {2 c f}{d}\right ) \text {Si}\left (\frac {2 c f}{d}+2 f x\right )}{d^2} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.21, antiderivative size = 159, normalized size of antiderivative = 1.00, number of steps
used = 9, number of rules used = 5, integrand size = 20, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3399, 3394,
3384, 3380, 3383} \begin {gather*} -\frac {a^2 f \text {CosIntegral}\left (\frac {2 c f}{d}+2 f x\right ) \sin \left (2 e-\frac {2 c f}{d}\right )}{d^2}-\frac {2 a^2 f \text {CosIntegral}\left (\frac {c f}{d}+f x\right ) \sin \left (e-\frac {c f}{d}\right )}{d^2}-\frac {2 a^2 f \cos \left (e-\frac {c f}{d}\right ) \text {Si}\left (x f+\frac {c f}{d}\right )}{d^2}-\frac {a^2 f \cos \left (2 e-\frac {2 c f}{d}\right ) \text {Si}\left (2 x f+\frac {2 c f}{d}\right )}{d^2}-\frac {4 a^2 \cos ^4\left (\frac {e}{2}+\frac {f x}{2}\right )}{d (c+d x)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3380
Rule 3383
Rule 3384
Rule 3394
Rule 3399
Rubi steps
\begin {align*} \int \frac {(a+a \cos (e+f x))^2}{(c+d x)^2} \, dx &=\left (4 a^2\right ) \int \frac {\sin ^4\left (\frac {e+\pi }{2}+\frac {f x}{2}\right )}{(c+d x)^2} \, dx\\ &=-\frac {4 a^2 \cos ^4\left (\frac {e}{2}+\frac {f x}{2}\right )}{d (c+d x)}+\frac {\left (8 a^2 f\right ) \int \left (-\frac {\sin (e+f x)}{4 (c+d x)}-\frac {\sin (2 e+2 f x)}{8 (c+d x)}\right ) \, dx}{d}\\ &=-\frac {4 a^2 \cos ^4\left (\frac {e}{2}+\frac {f x}{2}\right )}{d (c+d x)}-\frac {\left (a^2 f\right ) \int \frac {\sin (2 e+2 f x)}{c+d x} \, dx}{d}-\frac {\left (2 a^2 f\right ) \int \frac {\sin (e+f x)}{c+d x} \, dx}{d}\\ &=-\frac {4 a^2 \cos ^4\left (\frac {e}{2}+\frac {f x}{2}\right )}{d (c+d x)}-\frac {\left (a^2 f \cos \left (2 e-\frac {2 c f}{d}\right )\right ) \int \frac {\sin \left (\frac {2 c f}{d}+2 f x\right )}{c+d x} \, dx}{d}-\frac {\left (2 a^2 f \cos \left (e-\frac {c f}{d}\right )\right ) \int \frac {\sin \left (\frac {c f}{d}+f x\right )}{c+d x} \, dx}{d}-\frac {\left (a^2 f \sin \left (2 e-\frac {2 c f}{d}\right )\right ) \int \frac {\cos \left (\frac {2 c f}{d}+2 f x\right )}{c+d x} \, dx}{d}-\frac {\left (2 a^2 f \sin \left (e-\frac {c f}{d}\right )\right ) \int \frac {\cos \left (\frac {c f}{d}+f x\right )}{c+d x} \, dx}{d}\\ &=-\frac {4 a^2 \cos ^4\left (\frac {e}{2}+\frac {f x}{2}\right )}{d (c+d x)}-\frac {a^2 f \text {Ci}\left (\frac {2 c f}{d}+2 f x\right ) \sin \left (2 e-\frac {2 c f}{d}\right )}{d^2}-\frac {2 a^2 f \text {Ci}\left (\frac {c f}{d}+f x\right ) \sin \left (e-\frac {c f}{d}\right )}{d^2}-\frac {2 a^2 f \cos \left (e-\frac {c f}{d}\right ) \text {Si}\left (\frac {c f}{d}+f x\right )}{d^2}-\frac {a^2 f \cos \left (2 e-\frac {2 c f}{d}\right ) \text {Si}\left (\frac {2 c f}{d}+2 f x\right )}{d^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.33, size = 206, normalized size = 1.30 \begin {gather*} -\frac {a^2 \left (3 d+4 d \cos (e+f x)+d \cos (2 (e+f x))+2 f (c+d x) \text {CosIntegral}\left (\frac {2 f (c+d x)}{d}\right ) \sin \left (2 e-\frac {2 c f}{d}\right )+4 f (c+d x) \text {CosIntegral}\left (f \left (\frac {c}{d}+x\right )\right ) \sin \left (e-\frac {c f}{d}\right )+4 c f \cos \left (e-\frac {c f}{d}\right ) \text {Si}\left (f \left (\frac {c}{d}+x\right )\right )+4 d f x \cos \left (e-\frac {c f}{d}\right ) \text {Si}\left (f \left (\frac {c}{d}+x\right )\right )+2 c f \cos \left (2 e-\frac {2 c f}{d}\right ) \text {Si}\left (\frac {2 f (c+d x)}{d}\right )+2 d f x \cos \left (2 e-\frac {2 c f}{d}\right ) \text {Si}\left (\frac {2 f (c+d x)}{d}\right )\right )}{2 d^2 (c+d x)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.15, size = 276, normalized size = 1.74
method | result | size |
derivativedivides | \(\frac {\frac {f^{2} a^{2} \left (-\frac {2 \cos \left (2 f x +2 e \right )}{\left (c f -d e +d \left (f x +e \right )\right ) d}-\frac {2 \left (\frac {2 \sinIntegral \left (2 f x +2 e +\frac {2 c f -2 d e}{d}\right ) \cos \left (\frac {2 c f -2 d e}{d}\right )}{d}-\frac {2 \cosineIntegral \left (2 f x +2 e +\frac {2 c f -2 d e}{d}\right ) \sin \left (\frac {2 c f -2 d e}{d}\right )}{d}\right )}{d}\right )}{4}-\frac {3 f^{2} a^{2}}{2 \left (c f -d e +d \left (f x +e \right )\right ) d}+2 f^{2} a^{2} \left (-\frac {\cos \left (f x +e \right )}{\left (c f -d e +d \left (f x +e \right )\right ) d}-\frac {\frac {\sinIntegral \left (f x +e +\frac {c f -d e}{d}\right ) \cos \left (\frac {c f -d e}{d}\right )}{d}-\frac {\cosineIntegral \left (f x +e +\frac {c f -d e}{d}\right ) \sin \left (\frac {c f -d e}{d}\right )}{d}}{d}\right )}{f}\) | \(276\) |
default | \(\frac {\frac {f^{2} a^{2} \left (-\frac {2 \cos \left (2 f x +2 e \right )}{\left (c f -d e +d \left (f x +e \right )\right ) d}-\frac {2 \left (\frac {2 \sinIntegral \left (2 f x +2 e +\frac {2 c f -2 d e}{d}\right ) \cos \left (\frac {2 c f -2 d e}{d}\right )}{d}-\frac {2 \cosineIntegral \left (2 f x +2 e +\frac {2 c f -2 d e}{d}\right ) \sin \left (\frac {2 c f -2 d e}{d}\right )}{d}\right )}{d}\right )}{4}-\frac {3 f^{2} a^{2}}{2 \left (c f -d e +d \left (f x +e \right )\right ) d}+2 f^{2} a^{2} \left (-\frac {\cos \left (f x +e \right )}{\left (c f -d e +d \left (f x +e \right )\right ) d}-\frac {\frac {\sinIntegral \left (f x +e +\frac {c f -d e}{d}\right ) \cos \left (\frac {c f -d e}{d}\right )}{d}-\frac {\cosineIntegral \left (f x +e +\frac {c f -d e}{d}\right ) \sin \left (\frac {c f -d e}{d}\right )}{d}}{d}\right )}{f}\) | \(276\) |
risch | \(\frac {i a^{2} f \,{\mathrm e}^{\frac {i \left (c f -d e \right )}{d}} \expIntegral \left (1, i f x +i e +\frac {i \left (c f -d e \right )}{d}\right )}{d^{2}}-\frac {i f \,a^{2} {\mathrm e}^{-\frac {i \left (c f -d e \right )}{d}} \expIntegral \left (1, -i f x -i e -\frac {i c f -i d e}{d}\right )}{d^{2}}-\frac {3 a^{2}}{2 d \left (d x +c \right )}+\frac {i a^{2} f \,{\mathrm e}^{\frac {2 i \left (c f -d e \right )}{d}} \expIntegral \left (1, 2 i f x +2 i e +\frac {2 i \left (c f -d e \right )}{d}\right )}{2 d^{2}}-\frac {i f \,a^{2} {\mathrm e}^{-\frac {2 i \left (c f -d e \right )}{d}} \expIntegral \left (1, -2 i f x -2 i e -\frac {2 \left (i c f -i d e \right )}{d}\right )}{2 d^{2}}-\frac {a^{2} \left (-2 d x f -2 c f \right ) \cos \left (f x +e \right )}{d \left (d x +c \right ) \left (-d x f -c f \right )}-\frac {a^{2} \left (-2 d x f -2 c f \right ) \cos \left (2 f x +2 e \right )}{4 d \left (d x +c \right ) \left (-d x f -c f \right )}\) | \(314\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [C] Result contains complex when optimal does not.
time = 0.41, size = 396, normalized size = 2.49 \begin {gather*} -\frac {\frac {4 \, a^{2} f^{2}}{{\left (f x + e\right )} d^{2} + c d f - d^{2} e} + \frac {{\left (f^{2} {\left (E_{2}\left (\frac {2 \, {\left (-i \, {\left (f x + e\right )} d - i \, c f + i \, d e\right )}}{d}\right ) + E_{2}\left (-\frac {2 \, {\left (-i \, {\left (f x + e\right )} d - i \, c f + i \, d e\right )}}{d}\right )\right )} \cos \left (\frac {2 \, {\left (c f - d e\right )}}{d}\right ) - f^{2} {\left (i \, E_{2}\left (\frac {2 \, {\left (-i \, {\left (f x + e\right )} d - i \, c f + i \, d e\right )}}{d}\right ) - i \, E_{2}\left (-\frac {2 \, {\left (-i \, {\left (f x + e\right )} d - i \, c f + i \, d e\right )}}{d}\right )\right )} \sin \left (\frac {2 \, {\left (c f - d e\right )}}{d}\right ) + 2 \, f^{2}\right )} a^{2}}{{\left (f x + e\right )} d^{2} + c d f - d^{2} e} + \frac {4 \, {\left (f^{2} {\left (E_{2}\left (\frac {i \, {\left (f x + e\right )} d + i \, c f - i \, d e}{d}\right ) + E_{2}\left (-\frac {i \, {\left (f x + e\right )} d + i \, c f - i \, d e}{d}\right )\right )} \cos \left (\frac {c f - d e}{d}\right ) - f^{2} {\left (-i \, E_{2}\left (\frac {i \, {\left (f x + e\right )} d + i \, c f - i \, d e}{d}\right ) + i \, E_{2}\left (-\frac {i \, {\left (f x + e\right )} d + i \, c f - i \, d e}{d}\right )\right )} \sin \left (\frac {c f - d e}{d}\right )\right )} a^{2}}{{\left (f x + e\right )} d^{2} + c d f - d^{2} e}}{4 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.42, size = 289, normalized size = 1.82 \begin {gather*} -\frac {2 \, a^{2} d \cos \left (f x + e\right )^{2} + 4 \, a^{2} d \cos \left (f x + e\right ) + 2 \, a^{2} d + 2 \, {\left (a^{2} d f x + a^{2} c f\right )} \cos \left (-\frac {2 \, {\left (c f - d e\right )}}{d}\right ) \operatorname {Si}\left (\frac {2 \, {\left (d f x + c f\right )}}{d}\right ) + 4 \, {\left (a^{2} d f x + a^{2} c f\right )} \cos \left (-\frac {c f - d e}{d}\right ) \operatorname {Si}\left (\frac {d f x + c f}{d}\right ) + 2 \, {\left ({\left (a^{2} d f x + a^{2} c f\right )} \operatorname {Ci}\left (\frac {d f x + c f}{d}\right ) + {\left (a^{2} d f x + a^{2} c f\right )} \operatorname {Ci}\left (-\frac {d f x + c f}{d}\right )\right )} \sin \left (-\frac {c f - d e}{d}\right ) + {\left ({\left (a^{2} d f x + a^{2} c f\right )} \operatorname {Ci}\left (\frac {2 \, {\left (d f x + c f\right )}}{d}\right ) + {\left (a^{2} d f x + a^{2} c f\right )} \operatorname {Ci}\left (-\frac {2 \, {\left (d f x + c f\right )}}{d}\right )\right )} \sin \left (-\frac {2 \, {\left (c f - d e\right )}}{d}\right )}{2 \, {\left (d^{3} x + c d^{2}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} a^{2} \left (\int \frac {2 \cos {\left (e + f x \right )}}{c^{2} + 2 c d x + d^{2} x^{2}}\, dx + \int \frac {\cos ^{2}{\left (e + f x \right )}}{c^{2} + 2 c d x + d^{2} x^{2}}\, dx + \int \frac {1}{c^{2} + 2 c d x + d^{2} x^{2}}\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 1133 vs.
\(2 (161) = 322\).
time = 0.61, size = 1133, normalized size = 7.13 \begin {gather*} \frac {{\left (2 \, {\left (d x + c\right )} a^{2} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} f^{2} \operatorname {Ci}\left (-\frac {2 \, {\left ({\left (d x + c\right )} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} - c f + d e\right )}}{d}\right ) \sin \left (\frac {2 \, {\left (c f - d e\right )}}{d}\right ) - 2 \, a^{2} c f^{3} \operatorname {Ci}\left (-\frac {2 \, {\left ({\left (d x + c\right )} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} - c f + d e\right )}}{d}\right ) \sin \left (\frac {2 \, {\left (c f - d e\right )}}{d}\right ) + 2 \, a^{2} d f^{2} \operatorname {Ci}\left (-\frac {2 \, {\left ({\left (d x + c\right )} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} - c f + d e\right )}}{d}\right ) e \sin \left (\frac {2 \, {\left (c f - d e\right )}}{d}\right ) + 4 \, {\left (d x + c\right )} a^{2} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} f^{2} \operatorname {Ci}\left (-\frac {{\left (d x + c\right )} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} - c f + d e}{d}\right ) \sin \left (\frac {c f - d e}{d}\right ) - 4 \, a^{2} c f^{3} \operatorname {Ci}\left (-\frac {{\left (d x + c\right )} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} - c f + d e}{d}\right ) \sin \left (\frac {c f - d e}{d}\right ) + 4 \, a^{2} d f^{2} \operatorname {Ci}\left (-\frac {{\left (d x + c\right )} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} - c f + d e}{d}\right ) e \sin \left (\frac {c f - d e}{d}\right ) - 4 \, {\left (d x + c\right )} a^{2} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} f^{2} \cos \left (\frac {c f - d e}{d}\right ) \operatorname {Si}\left (-\frac {{\left (d x + c\right )} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} - c f + d e}{d}\right ) + 4 \, a^{2} c f^{3} \cos \left (\frac {c f - d e}{d}\right ) \operatorname {Si}\left (-\frac {{\left (d x + c\right )} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} - c f + d e}{d}\right ) - 4 \, a^{2} d f^{2} \cos \left (\frac {c f - d e}{d}\right ) e \operatorname {Si}\left (-\frac {{\left (d x + c\right )} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} - c f + d e}{d}\right ) - 2 \, {\left (d x + c\right )} a^{2} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} f^{2} \cos \left (\frac {2 \, {\left (c f - d e\right )}}{d}\right ) \operatorname {Si}\left (-\frac {2 \, {\left ({\left (d x + c\right )} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} - c f + d e\right )}}{d}\right ) + 2 \, a^{2} c f^{3} \cos \left (\frac {2 \, {\left (c f - d e\right )}}{d}\right ) \operatorname {Si}\left (-\frac {2 \, {\left ({\left (d x + c\right )} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} - c f + d e\right )}}{d}\right ) - 2 \, a^{2} d f^{2} \cos \left (\frac {2 \, {\left (c f - d e\right )}}{d}\right ) e \operatorname {Si}\left (-\frac {2 \, {\left ({\left (d x + c\right )} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} - c f + d e\right )}}{d}\right ) + a^{2} d f^{2} \cos \left (\frac {2 \, {\left (d x + c\right )} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )}}{d}\right ) + 4 \, a^{2} d f^{2} \cos \left (\frac {{\left (d x + c\right )} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )}}{d}\right ) + 3 \, a^{2} d f^{2}\right )} d^{2}}{2 \, {\left ({\left (d x + c\right )} d^{4} {\left (\frac {c f}{d x + c} - f - \frac {d e}{d x + c}\right )} - c d^{4} f + d^{5} e\right )} f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {{\left (a+a\,\cos \left (e+f\,x\right )\right )}^2}{{\left (c+d\,x\right )}^2} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________